<?php

$form = new Form();
$form->addInput(new FormInput("id", true, "text", "string", "Wydawca"));
$form->addInput(new FormInput("action", false, "submit", "string", "", array("value" => "Dodaj")));

if (isset($_POST['action']))
{
    $postAction = stripslashes($_POST['action']);
    if ($postAction == 'Usuń')
    {
        $id = $_POST['id'];
        $data = array($id);
        $status = Product::managePublishers(Product::ACTION_DELETE, $data);
        $this->view->setStatus($status['text'], $status['success']);
    }
    else if ($postAction == 'Dodaj')
    {
        $id = stripslashes($_POST['id']);
        $data = array($id);
        $status = Product::managePublishers(Product::ACTION_INSERT, $data);
        $this->view->setStatus($status['text'], $status['success']);
    }
}
$this->view->data = Product::listPublishers();
$this->view->formAddress = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
$this->view->form = $form;
$this->contentFile = "Admin/PublisherManage";
?>